package com.yoda.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yoda.entity.SysMenu;
import com.yoda.vo.MenuList;
import com.yoda.vo.MenuVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 菜单表 Mapper 接口
 * </p>
 *
 * @author itcast
 * @since 2023-05-15
 */

public interface SysMenuMapper extends BaseMapper<SysMenu> {

    //select * from sys_menu sm left join sys_role_menu srm on  sm.id = srm.menu_id left join sys_role sr on sr.id = srm.role_id where sr.id = #{id} and sm.type = 1 and sm.pid = #{pid}
    @Select("select * from sys_menu sm left join sys_role_menu srm on sm.id = srm.menu_id left join sys_role sr on sr.id = srm.role_id where sr.id = #{id} and sm.pid = #{pid} and sm.type = 1")
    List<MenuList> getMenus(String id, Integer pid);

    @Select("select * from sys_menu where pid = #{pid}")
    List<MenuList> getMenu(Integer pid);





}
